<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<title>用戶管理</title>
<style type="text/css">

</style>
<script type="text/javascript">

</script>
<%@ include file="/common/header.jsp" %>
    <div class="content-box">
      <!-- Start Content Box -->
      <div class="content-box-header">
        <h3>添加用戶</h3>
        <div class="clear"></div>
      </div>
      <!-- End .content-box-header -->
      <div class="content-box-content">
          <form:form action="${ctx }/user/save.do" method="post" modelAttribute="user" id="userForm">
            <div id="messageBox" class="alert alert-error input-large controls" style="display:none">输入有误，请先更正。</div>
            <fieldset class="user-add" >  
            <form:hidden path="appUserId"/> 
            <c:if test="${mode eq 'update' }">           
              <form:hidden path="password" />
            </c:if>   
            <p>
              <form:label path="userName">用戶名：</form:label>
              <input type="hidden" id="oldName" value="${user.userName }"/>
              <form:input cssClass="text-input small-input required" path="userName" />
            </p><c:if test="${mode eq 'save' }">
            <p>
              <form:label path="password">密碼：</form:label>
              <form:password cssClass="text-input small-input required" path="password" />
            </p></c:if>
            <p>
              <form:label path="permissions" >角色：</form:label>
              <form:checkboxes items="${permissions }" path="permissions" itemLabel="permissionName" itemValue="permissionId"/>
            </p>
            </fieldset>
            <div class="clear"></div>
            <!-- End .clear -->
            
            <p>
              <input class="button" type="submit" value="Submit" />
            </p>
            <div class="clear"></div>
          </form:form>
      </div>
      <!-- End .content-box-content -->
    </div>
    <!-- End .content-box -->   
    <div class="clear"></div>
 <%@ include file="/common/footer.jsp" %>
<script type="text/javascript" src="${ctx}/js/userAdd.js?_=${radom}"></script>
  <script type="text/javascript">
 $(function(){
	 $("#main-nav a[data-menu='user']").addClass("current").click();
	 $("#main-nav a[data-menu='userAdd']").addClass("current");
 })
 </script>